import askLeaveApi from '@/api/modules/askLeave'
import store from "@/store";

// 控制路由跳转
export async function handleGoTo() {
    // 查询当前请假状态
    const status = await getAskLeaveStatus()
    // 查询不到请假状态,跳转到请假页
    if (!status) {
        store.commit("UPDATE_ROUTEURL", "/pages/ask_leave/apply/index");
        return
    }
    store.commit("UPDATE_ROUTEURL", "/pages/ask_leave/status/index");
}

async function getAskLeaveStatus() {
    try {
        const res = await askLeaveApi.getAskLeaveStatus()
        return res.data.data
    } catch (e) {

    }
}
